<%@ page language="java" import="java.util.*,com.wonders.frame.chron.util.StringUtil" pageEncoding="UTF-8"%>
<%@ include file="/jsp/include/taglib.jsp"%>
<%@ include file="/jsp/include/headform.jsp"%>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//en"
"http://www.w3. org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>上传附件</title>
				
<script type="text/javascript">

//params
var Local = {
		_type : '${param.type}',//当前查询的类型，卡片还是长编
		_resourceType:'${param.resourceType}',
	};
	
var hidden = null;

$(function(){

	
	 $("#uploadify").uploadify({
		   'auto' : false,
	       'method' : "POST",
	       'height' : 30,
	       'width' : 100,
	       'swf' : '${ctxStatic}/uploadify/uploadify.swf', 
	       'uploader' : '${ctx}/api/importConfig/importCatalog?type=catalog_title&catalogType='+Local._type+"&resourceType="+Local._resourceType,
	       'fileTypeDesc' : '格式:xls，xlsx',		//描述
	       'fileTypeExts' : '*.xls;*.xlsx;',			//文件类型
	       'fileSizeLimit' : '20000KB',			//文件大小
	       'buttonText' : '选择文件',			//按钮名称
	       'fileObjName'	:'uploadify',
	       'multi' :false,
	       'successTimeout' : 300,
	       'requeueErrors' : false,
	       'removeTimeout' : 1,
	       'removeCompleted' : true,     
	       'queueID': 'fileQueue',
	       'onSelectError' : function(file,errorCode,errorMsg) {
	       		if(errorCode==-110){
	       			this.queueData.errorMsg = "文件太大，无法上传！";
	       		}
	        }, 
	        'onUploadStart' : function(file) {
	        	$.jBox.tip("目录导入中...", 'loading');
// 	        	parent.$.jBox.close();
	        },
	        'onUploadSuccess' : function(file, data, response){
			      var result = jQuery.parseJSON(data);
			      $.jBox.closeTip();
			      parent.location.reload();

			      /*if(result.info.success){
			    	  console.log("3:"+result.info.success);
			    	  $.jBox.closeTip();
			    	  $.jBox.tip('导入成功.','waring');
			    	  parent.location.reload();
			      }else{
			    	  alert('导入失败,请选择正确的目录模板.');
			    	  parent.location.reload();
			      }  */
	    	}
	});  
	
	/* $("#uploadify").uploadify({
		'auto' : false,
	       'method' : "post",
	       'height' : 20,
	       'width' : 100,
	       'swf' : '${ctxStatic}/uploadify/uploadify.swf', 
// 	       'uploader' : '${ctx}/api/importConfig/importCatalog?catalog_title',
		   'uploader' : '${ctx}/api/attach/upload',
	       'fileTypeDesc' : '格式:txt,xls，xlsx,doc,docx,rar,zip,jpg,png,pdf',		//描述
	       'fileTypeExts' : '*.txt;*.xls;*.xlsx;*.doc;*.docx;*.rar;*.zip;*.jpg;*.png;*.pdf',			//文件类型
	       'fileSizeLimit' : '20000KB',			//文件大小
	       'buttonText' : '选择文件',			//按钮名称
	       'fileObjName'	:'uploadify',
	       'multi' :true,
	       'successTimeout' : 5,
	       'requeueErrors' : false,
	       'removeTimeout' : 1,
	       'removeCompleted' : true,
	  		'onSelect' : function(file) {
	  			$(".uploadify").css("float","");
	     	},	       
       'onSelectError' : function(file,errorCode,errorMsg) {
       		if(errorCode==-110){
       			this.queueData.errorMsg = "文件太大，无法上传！";
       		}
        }, 
       'onUploadStart' : function(file) {
            $("#uploadify").uploadify("settings", "formData",{'attachMemo' : '附件1'});
        },
        'onUploadSuccess' : function(file, data, response){
		      var result = jQuery.parseJSON(data);
		      var attach=result.data[0];
		      
	     }
	}); */
	
	$(".uploadify").css("float","left");
});
</script>
<style>
</style>
</head>

<body style="width: 100%; background-color: transparent; background-color: FFF;">
	<div id="fileQueue"></div>
		<div>	
				<input type="file" name="uploadify" id="uploadify" />&nbsp;
				<input type="button" value="上传" onclick="$('#uploadify').uploadify('upload');"> &nbsp;&nbsp;单个附件不允许超过20M
		</div> 
</body>

</html>
